package com.hu.ssm.controller;

import com.hu.ssm.entity.Emp;
import com.hu.ssm.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class EmpController {

    private EmpService empService;

    @Autowired
    public EmpController(EmpService empService) {
        this.empService = empService;
    }

    @RequestMapping("/findAll")
    public List<Emp> findAll(){
        return this.empService.findAll();
    }

    @RequestMapping("/save")
    public void save(Emp emp){
        this.empService.save(emp);
    }

}
